home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / intsdkss.lha / unix.doc < prev   
Text File  |  1996-04-09  |  37KB  |  1,748 lines

  1. TABLE OF CONTENTS
  2.  
  3. unix/access
  4. unix/chdir
  5. unix/chmod
  6. unix/clean_sock
  7. unix/close
  8. unix/closedir
  9. unix/daemon_end
  10. unix/daemon_start
  11. unix/dup
  12. unix/dup2
  13. unix/err
  14. unix/errx
  15. unix/exit
  16. unix/getcwd
  17. unix/getopt
  18. unix/getwd
  19. unix/glob
  20. unix/globfree
  21. unix/init_sock
  22. unix/isatty
  23. unix/mkdir
  24. unix/opendir
  25. unix/pclose
  26. unix/perror
  27. unix/popen
  28. unix/read
  29. unix/readdir
  30. unix/rewinddir
  31. unix/rmdir
  32. unix/sleep
  33. unix/SockBase
  34. unix/socket_callback
  35. unix/stat
  36. unix/statfs
  37. unix/s_accept
  38. unix/s_socket
  39. unix/verr
  40. unix/verrx
  41. unix/vwarn
  42. unix/vwarnx
  43. unix/warn
  44. unix/warnx
  45. unix/write
  46. unix/access                                                       unix/access
  47.  
  48.    NAME
  49.     access -- Check the accessibility of a file
  50.  
  51.    SYNOPSIS
  52.     return = access (filename, mode)
  53.  
  54.     int access (const char *, int);
  55.  
  56.    FUNCTION
  57.     Checks to see if a file can be accessed with a certain mode.
  58.     Returns true (0) if mode is write and file is not found.
  59.  
  60.    INPUTS
  61.     filename    name of the file
  62.  
  63.     mode        file mode
  64.  
  65.  
  66.     If filename is ".", then it is dealt with as being the
  67.     current directory (i.e., a "" is passed to Lock()). If
  68.     filename is "..", then it is dealt with as being the
  69.     parent directory (i.e., a "/" is passed to Lock()). No
  70.     other "Unix-like" translation is performed.
  71.  
  72.                 Mode table
  73.     Integer     Mnemonic        Description
  74.  
  75.        0          F_OK        Does file exist?
  76.        1          X_OK        Is it executable?
  77.        2          W_OK        Is it writable?
  78.        4          R_OK        Is it readable?
  79.  
  80.     Mnemonics are in <sys/fcntl.h>.
  81.  
  82.    RESULT
  83.      0 is returned if successful.
  84.     -1 is returned on error, and errno is set appropriately.
  85.  
  86.    EXAMPLE
  87.  
  88.    NOTES
  89.     If the file doesn't exist, access() assumes that the file
  90.     can be written.
  91.  
  92.    BUGS
  93.     Executable and readable are treated the same on the Amiga.
  94.  
  95.    SEE ALSO
  96.  
  97. unix/chdir                                                         unix/chdir
  98.  
  99.    NAME
  100.     chdir -- change directory
  101.  
  102.    SYNOPSIS
  103.     result = chdir (path)
  104.  
  105.     int chdir (const char *);
  106.  
  107.    FUNCTION
  108.     chdir() changes the current working directory to the
  109.     specified path.
  110.  
  111.     chdir() ensures that the original starting directory
  112.     is returned to upon program exit.
  113.  
  114.    INPUTS
  115.     path    directory/pathname to change to
  116.  
  117.    RESULT
  118.     On success,  0 is returned.
  119.     On failure, -1 is returned, and errno is set.
  120.  
  121.    EXAMPLE
  122.  
  123.    NOTES
  124.  
  125.    BUGS
  126.  
  127.    SEE ALSO
  128.  
  129. unix/chmod                                                         unix/chmod
  130.  
  131.    NAME
  132.     chmod -- change directory
  133.  
  134.    SYNOPSIS
  135.     return = chmod (name, unixmask)
  136.  
  137.     int chmod (const char *name, const int unixmask);
  138.  
  139.    FUNCTION
  140.     chmod() changes the specified file's attributes.  It
  141.     translates the UNIX compatible attribute mask into the
  142.     equivalent Amiga attributes, then sets those protections
  143.     on the given file.
  144.  
  145.     chmod() will set the GROUP and OTHER attributes, as
  146.     well as the standard set of -SPARWED, though no current
  147.     Amiga OS (<= V42) will copy or pay any attention to
  148.     these, it is still useful for NFS mounted volumes.
  149.  
  150.    INPUTS
  151.     name        - name of file to modify
  152.     unixmask    - UNIX attribute mask for a file
  153.  
  154.    RESULT
  155.     0 is returned if successful.  -1 is returned on error.
  156.  
  157.    EXAMPLE
  158.  
  159.    NOTES
  160.  
  161.    BUGS
  162.  
  163.    SEE ALSO
  164.     chmod command (in Inet:c, docs in Inet:docs/chmod.guide)
  165.  
  166. unix/clean_sock                                               unix/clean_sock
  167.  
  168.    NAME
  169.     clean_sock - cleanup and shutdown socket.library
  170.  
  171.    SYNOPSIS
  172.     clean_sock ();
  173.  
  174.     void clean_sock (void);
  175.  
  176.    FUNCTION
  177.     clean_sock() determines whether socket.library is
  178.     open, and if so, calls cleanup_sockets(), closes
  179.     the library, and sets the library base to NULL.
  180.  
  181.     The internal (to unix.lib) indicator for socket
  182.     being setup is reset.
  183.  
  184.    INPUTS
  185.     None.
  186.  
  187.    RESULT
  188.     None.
  189.  
  190.    NOTES
  191.     For clients, and non-inetd servers, this should be called
  192.     from an auto-termination routine, after standard I/O cleanup
  193.     is complete. The suggested name and priority for the destructor
  194.     is _STD_175_cleanup.
  195.  
  196.     For inetd servers, this should be called prior to standard I/O
  197.     cleanup, but still in an auto-termination routine.
  198.  
  199.    BUGS
  200.  
  201.    SEE ALSO
  202.     init_sock()
  203.  
  204. unix/close                                                         unix/close
  205.  
  206.    NAME
  207.     close -- close a file or socket
  208.  
  209.    SYNOPSIS
  210.     status = close (unit);
  211.  
  212.     int  = close (int);
  213.  
  214.    FUNCTION
  215.     This function closes a file or socket.
  216.  
  217.    INPUTS
  218.     unit      unit number
  219.  
  220.    RESULT
  221.     status      = 0 if successful
  222.           = -1 if error occurred
  223.  
  224.    EXAMPLE
  225.  
  226.    NOTES
  227.     This replaces the normal compiler close() function.
  228.  
  229.     close() is a wrapper for the __close() function in
  230.     sc.lib and for s_close() in socket.library. If the unit
  231.     has been marked as a socket, then s_close() is called,
  232.     otherwise __close() is called.
  233.  
  234.     If you are using unix.lib to obtain stdio on sockets,
  235.     you must use close() instead of __close(). You must
  236.     also open socket.library using init_sock().
  237.  
  238.    BUGS
  239.  
  240.    SEE ALSO
  241.     init_sock
  242.     read
  243.     write
  244.  
  245. unix/closedir                                                   unix/closedir
  246.  
  247.    NAME
  248.     closedir -- closes a directory stream
  249.  
  250.    SYNOPSIS
  251.     #include <sys/dir.h>
  252.  
  253.     result = closedir (dirp)
  254.  
  255.     int closedir (DIR *);
  256.  
  257.    FUNCTION
  258.     Closes the named directory stream.
  259.  
  260.    INPUTS
  261.     dirp    directory stream from opendir().
  262.  
  263.    RESULT
  264.     Returns 0.
  265.  
  266.    EXAMPLE
  267.  
  268.    NOTES
  269.     It is safe to call closedir() with a NULL parameter.
  270.  
  271.     You should not touch the parameter after calling
  272.     closedir() as its memory will be freed.
  273.  
  274.    BUGS
  275.  
  276.    SEE ALSO
  277.     readdir(), rewinddir(), opendir()
  278.  
  279. unix/daemon_end                                               unix/daemon_end
  280.  
  281.    NAME
  282.     daemon_end - reverse daemon_start effects
  283.  
  284.    SYNOPSIS
  285.     void daemon_end (void);
  286.  
  287.    FUNCTION
  288.     This function restores the compiler provided stdin and
  289.     stdout to where compiler clean-up code expects it.
  290.  
  291.    INPUTS
  292.     None.
  293.  
  294.    RESULT
  295.     None.
  296.  
  297.    NOTES
  298.     This is normally called from a destructor (_STD) routine.
  299.  
  300.     clean_sock() should be called after daemon_end().
  301.  
  302.    BUGS
  303.  
  304.    SEE ALSO
  305.     daemon_start
  306.     clean_sock
  307.  
  308. unix/daemon_start                                           unix/daemon_start
  309.  
  310.    NAME
  311.     daemon_start - map stdout and stdin to inetd socket
  312.  
  313.    SYNOPSIS
  314.     int daemon_start (unsigned long *sp)
  315.  
  316.    FUNCTION
  317.     daemon_start() goes through a variety of machinations
  318.     to close down the compiler provided stdin and stdout,
  319.     and then inherit the socket provided by inetd, and then
  320.     map that socket to stdin, then duplicate the socket and
  321.     map the duplicate to stdout.
  322.  
  323.    INPUTS
  324.     'sp' is the value of the second parameter (SOCKPTR)
  325.     provided by inetd.
  326.  
  327.    RESULT
  328.     On success, 0 is returned.
  329.     On failure, -1 is returned, and errno is set.
  330.  
  331.    NOTES
  332.     init_sock() should be called prior to calling daemon_start().
  333.  
  334.     This is typically called from a constructor (_STI) routine.
  335.  
  336.    BUGS
  337.  
  338.    SEE ALSO
  339.     init_sock
  340.     s_inherit()
  341.     daemon_end
  342.  
  343. unix/dup                                                             unix/dup
  344.  
  345.    NAME
  346.     dup - duplicate an open file descriptor
  347.  
  348.    SYNOPSIS
  349.     int dup (int oldfd);
  350.  
  351.    FUNCTION
  352.     Essentially a front-end to dup2(), dup() finds the
  353.     first free file descriptor, and then calls dup2()
  354.     with that as the "newfd" parameter.
  355.  
  356.    INPUTS
  357.     The file descriptor to be duplicated.
  358.  
  359.    RESULT
  360.     On success, the new fd.
  361.     On failure, -1, and errno is set.
  362.  
  363.    NOTES
  364.     Works for sockets and file descriptors. See dup2()
  365.     for caveats.
  366.  
  367.     dup() does some sanity checking before calling dup2().
  368.  
  369.    BUGS
  370.     See dup2().
  371.  
  372.    SEE ALSO
  373.     dup2()
  374.  
  375. unix/dup2                                                           unix/dup2
  376.  
  377.    NAME
  378.     dup2 - duplicate an open file descriptor
  379.  
  380.    SYNOPSIS
  381.     int dup2 (int oldfd, int newfd);
  382.  
  383.    FUNCTION
  384.     "oldfd" is a file descriptor referring to an open file,
  385.     and "newfd" is a non-negative integer. dup2() causes
  386.     "newfd" to refer to the same file as "oldfd".
  387.  
  388.     This implementation works for sockets, as well as for
  389.     files.
  390.  
  391.     If "newfd" refers to a current open file or socket, it is
  392.     close()'d.
  393.  
  394.     If "oldfd" is not open, an error is returned. If "oldfd"
  395.     or "newfd" are less than zero, an error is returned. If
  396.     a new file descriptor cannot be allocated for "newfd",
  397.     an error is returned.
  398.  
  399.    INPUTS
  400.     See above.
  401.  
  402.    RESULT
  403.     On success, "newfd" is returned.
  404.     On failure, -1 is returned, and errno is set.
  405.  
  406.    NOTES
  407.     If you are using unix.lib to obtain stdio on sockets, you
  408.     must use dup() and dup2() from unix.lib, and not s_dup() and
  409.     s_dup2() from socket.library.
  410.  
  411.     For sockets, this implementation is faithful to the Unix
  412.     implementation. For _files_, a close() on "newfd" is _ignored_.
  413.     For close action to take place, the _original_ fd must be
  414.     close. If the original is closed, and the duplicate is not,
  415.     operations on the duplicate are undefined (and a crash is
  416.     likely).
  417.  
  418.     A tiny bit of trickery can turn these around. If you want the
  419.     duplicate to be the "master" then:
  420.  
  421.        if (ufb = __chkufb (newfd))
  422.            ufb->ufbflg &= ~UFB_NC;
  423.        if (ufb = __chkufb (oldfd))
  424.            ufb->ufbflg |= UFB_NC;
  425.  
  426.    BUGS
  427.     The SAS/C file abstraction is not "abstract enough" to make this
  428.     completely right on the Amiga (for files, sockets are fine).
  429.  
  430.    SEE ALSO
  431.  
  432. unix/err                                                             unix/err
  433.  
  434.    NAME
  435.     err    -- print an error message and EXIT.
  436.  
  437.    SYNOPSIS
  438.     #include <err.h>
  439.  
  440.     err (eval, fmt, ...)
  441.  
  442.     void err (int eval, const char *fmt, ...);
  443.  
  444.    FUNCTION
  445.     Prints an error message of the form
  446.  
  447.         <progname>: [<formatted fmt>: ]<errno error message>
  448.  
  449.     and then exits with the value of 'eval'.
  450.  
  451.    INPUTS
  452.     eval        - value for exit() call; program return code
  453.     fmt        - if non-NULL, format & print output, followed
  454.               by errno information string.  If NULL, only
  455.               errno information string is output.
  456.     ...        - variable list of args for format string, fmt
  457.  
  458.    RESULT
  459.     None
  460.  
  461.    EXAMPLE
  462.  
  463.    NOTES
  464.     First appeared in BSD 4.4.
  465.  
  466.    BUGS
  467.  
  468.    SEE ALSO
  469.     verr(), errx(), verrx(), warn(), vwarn(), warnx(), vwarnx()
  470.  
  471. unix/errx                                                           unix/errx
  472.  
  473.    NAME
  474.     errx    -- print an error message and EXIT.
  475.  
  476.    SYNOPSIS
  477.     #include <err.h>
  478.  
  479.     errx (eval, fmt, ...)
  480.  
  481.     void errx (int eval, const char *fmt, ...);
  482.  
  483.    FUNCTION
  484.     Prints an error message of the form
  485.  
  486.         <progname>: [<formatted fmt>]
  487.  
  488.     and then exits with the value of 'eval'.
  489.  
  490.    INPUTS
  491.     eval        - value for exit() call; program return code
  492.     fmt        - if non-NULL, format & print output
  493.     ...        - variable list of args for format string, fmt
  494.  
  495.    RESULT
  496.     None
  497.  
  498.    EXAMPLE
  499.  
  500.    NOTES
  501.  
  502.    BUGS
  503.  
  504.    SEE ALSO
  505.     err(), verr(), verrx(), warn(), vwarn(), warnx(), vwarnx()
  506.  
  507. unix/exit                                                           unix/exit
  508.  
  509.    NAME
  510.     exit -- cleanup and exit program
  511.  
  512.    SYNOPSIS
  513.     exit (status)
  514.  
  515.     void exit (int);
  516.  
  517.    FUNCTION
  518.     This routine closes all stdio (level 2) files.
  519.  
  520.     The BSD return code is mapped to an AmigaDOS return code.
  521.  
  522.    INPUTS
  523.     status        integer -  mapped as follows
  524.  
  525.     BSD            AmigaDOS
  526.      1            RETURN_FAIL    (20)
  527.      0            RETURN_OK    (0)
  528.     -1            RETURN_WARN    (5)
  529.  
  530.    NOTES
  531.  
  532.    BUGS
  533.     Doesn't call atexit() routines. Use autoexit destructors
  534.     instead.
  535.  
  536.    SEE ALSO
  537.  
  538. unix/getcwd                                                       unix/getcwd
  539.  
  540.    NAME
  541.     getcwd    -- get the Current Working Directory.
  542.  
  543.    SYNOPSIS
  544.     p = getcwd (b, size);
  545.  
  546.     char *getcwd (char *b, int size);
  547.  
  548.    FUNCTION
  549.     This function obtains the path name for the current working
  550.     directory.  If the buffer pointer b is not NULL, then the path
  551.     string is placed there if it will fit, and the return pointer p
  552.     is the same as the pointer b. If the pointer b is NULL, then the
  553.     malloc() function is used to obtain a buffer of size bytes to
  554.     hold the path string. In the latter case, you should use the
  555.     free() function to release the buffer when you are finished with
  556.     it.
  557.  
  558.    INPUTS
  559.     b        - Points to path buffer
  560.     size        - Size of path buffer
  561.  
  562.    RESULT
  563.     p        - Same as b if successful, else NULL and errno
  564.               contains error information.
  565.  
  566.    EXAMPLE
  567.  
  568.    NOTES
  569.  
  570.    BUGS
  571.  
  572.    SEE ALSO
  573.     getwd()
  574.  
  575. unix/getopt                                                       unix/getopt
  576.  
  577.    NAME
  578.     getopt - get option letter from argument vector
  579.  
  580.    SYNOPSIS
  581.     int getopt (int argv, char **argv, char *optstring);
  582.  
  583.     extern char *optarg;
  584.  
  585.     extern int optind, opterr, optopt;
  586.  
  587.    FUNCTION
  588.     getopt() returns the next options letter in "argv" that
  589.     matches a letter in "optstring".
  590.  
  591.     "optstring" must contain the valid option letters. If a
  592.     if a letter is followed by a colon, the option is required
  593.     to have an argument (which may be separated from the letter
  594.     by white space). "optarg" points to the argument when
  595.     getopt() returns.
  596.  
  597.     "optind" is the index into "argv" of the next argument to
  598.     be processed. It is external to the calling program, and
  599.     is initialized to one prior to the first getopt() call.
  600.  
  601.     When all options have been processed, getopt() returns
  602.     EOF.
  603.  
  604.    INPUTS
  605.  
  606.    RESULT
  607.     EOF when done.
  608.  
  609.     '?' when an unknown option letter is encountered.
  610.  
  611.     Otherwise, the letter to be processed.
  612.  
  613.    NOTES
  614.     If an error occurs, getopt() prints an error message on
  615.     stderr. This can be suppresed by setting opterr to zero.
  616.     The value of the character that caused the error is
  617.     contained in optopt.
  618.  
  619.     The special string "--" causes getopt() to return EOF.
  620.  
  621.    BUGS
  622.  
  623.    SEE ALSO
  624.  
  625. unix/getwd                                                         unix/getwd
  626.  
  627.    NAME
  628.     getwd    -- get the Current Working Directory.
  629.  
  630.    SYNOPSIS
  631.     p = getwd (b);
  632.  
  633.     char *getwd (char *b);
  634.  
  635.    FUNCTION
  636.     This function obtains the path name for the current working
  637.     directory.  If the buffer pointer b is not NULL, then the path
  638.     string is placed there if it will fit, and the return pointer p
  639.     is the same as the pointer b. If the pointer b is NULL, then the
  640.     malloc() function is used to obtain a buffer of MAXPATHLEN bytes
  641.     to hold the path string. In the latter case, you should use the
  642.     free() function to release the buffer when you are finished with
  643.     it.
  644.  
  645.    INPUTS
  646.     b        - Points to path buffer.  Assumed to be of size
  647.               MAXPATHLEN or greater.
  648.  
  649.    RESULT
  650.     p        - Same as b if successful, else NULL
  651.  
  652.    EXAMPLE
  653.  
  654.    NOTES
  655.     You should use getcwd() instead, so that the buffer size may be
  656.     specified.
  657.  
  658.    BUGS
  659.  
  660.    SEE ALSO
  661.     getcwd()
  662.  
  663. unix/glob                                                           unix/glob
  664.  
  665.    NAME
  666.     glob - find pathnames matching a pattern
  667.  
  668.    SYNOPSIS
  669.     #include <glob.h>
  670.  
  671.     int glob (const char *pattern, int flags,
  672.           int errfunc (char char *epath, int eerrno),
  673.           glob_t *pglob);
  674.  
  675.    FUNCTION
  676.     The glob() function searches for all the pathnames
  677.     matching "pattern" according the rules used by the
  678.     Unix shell. No tilde expansion or parameter substitution
  679.     is done.
  680.  
  681.     The results of a glob() call are stored in the structure
  682.     pointed to by pglob, which is a glob_t which is declared
  683.     in <glob.h> as
  684.  
  685.     typedef struct
  686.     {
  687.         int gl_pathc;    /* Count of paths matched so far  */
  688.         char **gl_pathv;    /* List of matched pathnames.  */
  689.         int gl_offs;    /* Slots to be reserved in `gl_pathv'.  */
  690.         int gl_flags;    /* Flags for globbing  */
  691.     } glob_t;
  692.  
  693.     Results are stored in dynamically allocated storage.
  694.  
  695.     The parameter flags is made up of bitwise OR of zero or
  696.     more of the following symbolic constants, which modify the
  697.     of behaviour of glob():
  698.  
  699.     GLOB_ERR
  700.          which means to return upon read  error  (because  a
  701.          directory    does not have read permission, for exam-
  702.          ple).
  703.  
  704.     GLOB_MARK
  705.          which means to append a slash to  each  path  which
  706.          corresponds to a directory,
  707.  
  708.     GLOB_NOSORT
  709.          which means don't sort the returned pathnames (they
  710.          are by default),
  711.  
  712.     GLOB_DOOFS
  713.          which  means  that  pglob->gl_offs  slots    will  be
  714.          reserved at the beginning of the list of strings in
  715.          pglob->pathv,
  716.  
  717.     GLOB_NOCHECK
  718.          which means that, if no pattern matches, to  return
  719.          the original pattern,
  720.  
  721.     GLOB_APPEND
  722.          which  means to append to the results of a previous
  723.          call.  Do not set this flag on the first invocation
  724.          of glob().
  725.  
  726.     GLOB_NOESCAPE
  727.          which  means  that meta characters cannot be quoted
  728.          by backspaces, and
  729.  
  730.     GLOB_PERIOD
  731.          which means that a leading period can be matched by
  732.          meta characters.
  733.  
  734.     If  errfunc  is  not NULL, it will be called in case of an
  735.     error with the arguments epath a pointer to the path which
  736.     failed    and eerrno the value of errno as returned from one
  737.     of the calls  to  opendir(),  readdir(),  or  stat().    If
  738.     errfunc  returns non - zero, or if GLOB_ERR is set, glob()
  739.     will terminate after the call to errfunc.
  740.  
  741.     Upon successful return, mpglob->gl_pathc contains the  number
  742.     of matched pathnames and pglob->gl pathv a pointer to the
  743.     list of matched pathnames.  The first pointer after the last
  744.     pathname is NULL.
  745.  
  746.     It is possible to call glob() several times. In that case,
  747.     the GLOB_APPEND flag has to be set in flags on the second
  748.     and later invocations.
  749.  
  750.    INPUTS
  751.  
  752.    RESULT
  753.     On successful completion, glob() returns zero.    Other possible
  754.     returns are:
  755.  
  756.     GLOB_NOSPACE
  757.            for running out of memory,
  758.  
  759.     GLOB_ABEND
  760.            for a read error, and
  761.  
  762.     GLOB_NOMATCH
  763.            for no found matches.
  764.  
  765.    NOTES
  766.  
  767.    BUGS
  768.     The  glob() function may fail due to failure of underlying
  769.     function calls, such as malloc() or opendir().    These will
  770.     store their error code in errno.
  771.  
  772.    SEE ALSO
  773.  
  774. unix/globfree                                                   unix/globfree
  775.  
  776.    NAME
  777.     globfree - free memory from glob()
  778.  
  779.    SYNOPSIS
  780.     #include <glob.h>
  781.  
  782.     void globfree (glob_t *pglob);
  783.  
  784.    FUNCTION
  785.     The globfree() function frees the dynamically allocated
  786.     storage from an earlier call to glob().
  787.  
  788.    INPUTS
  789.     A glob_t passed earlier to glob().
  790.  
  791.    RESULT
  792.     None.
  793.  
  794.    NOTES
  795.  
  796.    BUGS
  797.  
  798.    SEE ALSO
  799.  
  800. unix/init_sock                                                 unix/init_sock
  801.  
  802.    NAME
  803.     init_sock - setup socket.library and associated stuff
  804.  
  805.    SYNOPSIS
  806.     retval = init_sock ();
  807.     D0
  808.  
  809.     int init_sock (void);
  810.  
  811.    FUNCTION
  812.     init_sock() determines whether socket.library has already
  813.     been opened and setup previously. If so, it does nothing
  814.     and returns with a value of zero.
  815.  
  816.     Otherwise, init_sock() opens the library, calls setup_sockets()
  817.     with FD_SETSIZE (i.e., the maximum number of sockets allowed)
  818.     and the default "extern int errno".
  819.  
  820.     The socket allocator is pointed to the proper socket_callback()
  821.     for the compiler.
  822.  
  823.     The global signals socket_sigurg and socket_sigio are set to
  824.     their default values.
  825.  
  826.     The internal (to unix.lib) list of sockets is emptied.
  827.  
  828.    INPUTS
  829.     None.
  830.  
  831.    RESULT
  832.      0 on success
  833.     -1 on failure (errno is set to ECONFIGPROBLEM)
  834.  
  835.    NOTES
  836.     For clients, this should be called from an auto-initialization
  837.     routine, before standard I/O setup. The suggested name and priority
  838.     for the constructor is _STI_175_init. For inetd servers (which map
  839.     stdin and stdout to the socket passed to them from inetd) this
  840.     should be called after standard I/O setup. For non-inetd servers,
  841.     the client recommendation applies.
  842.  
  843.    BUGS
  844.  
  845.    SEE ALSO
  846.     clean_sock()
  847.     setup_sockets()
  848.     s_dev_func()
  849.     s_getsignal()
  850.  
  851. unix/isatty                                                       unix/isatty
  852.  
  853.    NAME
  854.     isatty - does file descriptor refer to a terminal device
  855.  
  856.    SYNOPSIS
  857.     rslt = isatty (fd);
  858.  
  859.     int isatty (int fd);
  860.  
  861.    FUNCTION
  862.     If 'fd' refers to an interactive file descriptor, the
  863.     isatty() function returns 1, and otherwise zero.
  864.  
  865.    INPUTS
  866.     fd  - the file descriptor in question
  867.  
  868.    RESULT
  869.     If interactive, returns 1.
  870.     If non-interactive, returns 0;
  871.  
  872.    NOTES
  873.  
  874.    BUGS
  875.  
  876.    SEE ALSO
  877.  
  878. unix/mkdir                                                         unix/mkdir
  879.  
  880.    NAME
  881.     mkdir -- make a new directory
  882.  
  883.    SYNOPSIS
  884.     mkdir (path, mode)
  885.  
  886.     int mkdir (const char *path, int mode);
  887.  
  888.    FUNCTION
  889.     Simply calls AmigaDOS 'CreateDir()' function to create a new,
  890.     directory, then calls 'chmod()' to set the specified 'mode', or
  891.     protections, on that directory.
  892.  
  893.    INPUTS
  894.     path        - what directory to create
  895.     mode        - mode to set for directory
  896.  
  897.    RESULT
  898.     On success,  0 is returned.
  899.     On failure, -1 is returned and errno is set.
  900.  
  901.    EXAMPLE
  902.  
  903.    NOTES
  904.  
  905.    BUGS
  906.  
  907.    SEE ALSO
  908.     dos.library/CreateDir(), unix/chmod()
  909.  
  910. unix/opendir                                                     unix/opendir
  911.  
  912.    NAME
  913.     opendir -- opens a directory
  914.  
  915.    SYNOPSIS
  916.     #include <sys/dir.h>
  917.  
  918.     dirp = opendir (dirname)
  919.  
  920.     DIR *opendir (char *);
  921.  
  922.    FUNCTION
  923.     Opens the named directory and returns a pointer to the
  924.     directory stream.
  925.  
  926.    INPUTS
  927.     dirname     name of the directory to open
  928.  
  929.    RESULT
  930.     Returns a pointer to the directory stream if successful.
  931.     Returns NULL if dirname cannot be accessed, or other
  932.     error occurs.
  933.  
  934.     errno is set to ENOENT, if the AmigaDOS Lock() fails, to
  935.     EIO if the AmigaDOS Examine() fails, and ENOMEM if the
  936.     allocation of the DIR structure fails.
  937.  
  938.    EXAMPLE
  939.  
  940.    NOTES
  941.  
  942.    BUGS
  943.  
  944.    SEE ALSO
  945.     readdir(), rewinddir(), closedir()
  946.  
  947. unix/pclose                                                       unix/pclose
  948.  
  949.    NAME
  950.     pclose - close a pipe to another process
  951.  
  952.    SYNOPSIS
  953.     #include <stdio.h>
  954.  
  955.     pclose (stream);
  956.  
  957.     void pclose (FILE *stream);
  958.  
  959.    FUNCTION
  960.     pclose() closes a pipe opened by popen().
  961.  
  962.    INPUTS
  963.     stream        - the result from popen().
  964.  
  965.    RESULT
  966.     None.
  967.  
  968.    NOTES
  969.  
  970.    BUGS
  971.  
  972.    SEE ALSO
  973.  
  974. unix/perror                                                       unix/perror
  975.  
  976.    NAME
  977.     perror - print a system error message
  978.  
  979.    SYNOPSIS
  980.     #include <stdio.h>
  981.  
  982.     void perror (const char *str);
  983.  
  984.    FUNCTION
  985.     perror outputs a message to stderr (using stdio)
  986.     describing the last error encountered during a call
  987.     to a system or library function. This value is taken
  988.     from the global integer "errno".
  989.  
  990.     The argument string "str" is printed first, if it is
  991.     non-NULL, then a colon and a blank, then the error
  992.     message followed by a newline.
  993.  
  994.    INPUTS
  995.     str  - a header string (which should include a program
  996.            name and other useful information)
  997.  
  998.    RESULT
  999.     None.
  1000.  
  1001.    NOTES
  1002.     This perror() differs from the one in the compiler
  1003.     library because it uses the socket.library strerror()
  1004.     entrypoint to determine the error message (which
  1005.     includes the standard error messages, as well as
  1006.     network related ones).
  1007.  
  1008.     Thus, if socket.library is not open, an error message
  1009.     cannot be provided.
  1010.  
  1011.    BUGS
  1012.  
  1013.    SEE ALSO
  1014.  
  1015. unix/popen                                                         unix/popen
  1016.  
  1017.    NAME
  1018.     popen - initiate a pipe to another process
  1019.  
  1020.    SYNOPSIS
  1021.     #include <stdio.h>
  1022.  
  1023.     f = popen ("ls", "r");
  1024.  
  1025.     FILE *popen (char *program, char *type);
  1026.  
  1027.    FUNCTION
  1028.     popen() creates a pipe between the calling program and the
  1029.     command to be executed. The arguments to popen() are pointers
  1030.     to null terminated strings.
  1031.  
  1032.    INPUTS
  1033.     command     - A Shell command line
  1034.     type        - I/O mode, "r" for reading, "w" for writing.
  1035.  
  1036.    RESULT
  1037.     On success, a stream pointer to the called process.
  1038.     On failure, NULL.
  1039.  
  1040.    NOTES
  1041.     This depends on the PIPE: device, and that PIPE: is set
  1042.     up as documented in the INet installation notes.
  1043.  
  1044.    BUGS
  1045.  
  1046.    SEE ALSO
  1047.  
  1048. unix/read                                                           unix/read
  1049.  
  1050.    NAME
  1051.     read -- read from a file or socket
  1052.  
  1053.    SYNOPSIS
  1054.     status = read (unit, buffer, length);
  1055.  
  1056.     int  = read (int, void *, unsigned int);
  1057.  
  1058.    FUNCTION
  1059.     This function reads the next set of bytes from a file
  1060.     or socket that has been activated via a previous open(),
  1061.     s_accept(), s_socket(), dup() or dup2() call.
  1062.  
  1063.    INPUTS
  1064.     unit      unit number
  1065.     buffer      input buffer
  1066.     length      buffer length in bytes
  1067.  
  1068.    RESULT
  1069.     status      = number of bytes actually read
  1070.           = 0 if end of file
  1071.           = -1 if error occurred
  1072.  
  1073.    EXAMPLE
  1074.  
  1075.    NOTES
  1076.     This replaces the normal compiler read() function.
  1077.  
  1078.     read() is a wrapper for the __read() function in
  1079.     sc.lib and for recv() in socket.library. If the unit
  1080.     has been marked as a socket, then recv() is called,
  1081.     otherwise __read() is called.
  1082.  
  1083.     If you are using unix.lib to obtain stdio on sockets,
  1084.     you must use read() instead of __read(). You must
  1085.     also open socket.library using init_sock().
  1086.  
  1087.    BUGS
  1088.  
  1089.    SEE ALSO
  1090.     init_sock()
  1091.     close()
  1092.     write()
  1093.  
  1094. unix/readdir                                                     unix/readdir
  1095.  
  1096.    NAME
  1097.     readdir -- reads a directory
  1098.  
  1099.    SYNOPSIS
  1100.     #include <sys/dir.h>
  1101.  
  1102.     next_dir = readdir (dirp)
  1103.  
  1104.     struct direct *readdir (DIR *);
  1105.  
  1106.    FUNCTION
  1107.     returns a pointer to the next directory entry.
  1108.  
  1109.    INPUTS
  1110.     dirp    directory stream from opendir().
  1111.  
  1112.    RESULT
  1113.     Returns a pointer to the next directory entry if successful.
  1114.     Returns NULL on end of directory.
  1115.  
  1116.    EXAMPLE
  1117.  
  1118.    NOTES
  1119.  
  1120.    BUGS
  1121.  
  1122.    SEE ALSO
  1123.     opendir(), rewinddir(), closedir()
  1124.  
  1125. unix/rewinddir                                                 unix/rewinddir
  1126.  
  1127.    NAME
  1128.     rewinddir -- set position in directory back to beginning.
  1129.  
  1130.    SYNOPSIS
  1131.     #include <sys/dir.h>
  1132.  
  1133.     result = rewinddir (dirp)
  1134.  
  1135.     int rewinddir (DIR *);
  1136.  
  1137.    FUNCTION
  1138.     Sets the position in the directory stream back to the beginning.
  1139.  
  1140.    INPUTS
  1141.     dirp    directory stream from opendir().
  1142.  
  1143.    RESULT
  1144.     On success,  0 is returned.
  1145.     On failure, -1 is returned (errno is not set).
  1146.  
  1147.    EXAMPLE
  1148.  
  1149.    NOTES
  1150.  
  1151.    BUGS
  1152.  
  1153.    SEE ALSO
  1154.     readdir(), opendir(), closedir()
  1155.  
  1156. unix/rmdir                                                         unix/rmdir
  1157.  
  1158.    NAME
  1159.     rmdir -- remove a directory
  1160.  
  1161.    SYNOPSIS
  1162.     rslt = rmdir (path)
  1163.  
  1164.     int rmdir (const char *path);
  1165.  
  1166.    FUNCTION
  1167.     Simply calls AmigaDOS 'DeleteFile()' function (since there is no
  1168.     real distinction in the Amiga OS between files and directories,
  1169.     at least as far as deleting them goes) on the given path.
  1170.  
  1171.    INPUTS
  1172.     path        - path to directory to remove
  1173.  
  1174.    RESULT
  1175.     On success,  0 is returned.
  1176.     On failure, -1 is returned, and errno is set.
  1177.  
  1178.    EXAMPLE
  1179.  
  1180.    NOTES
  1181.  
  1182.    BUGS
  1183.  
  1184.    SEE ALSO
  1185.     dos.library/DeleteFile()
  1186.  
  1187. unix/sleep                                                         unix/sleep
  1188.  
  1189.    NAME
  1190.     sleep -- suspend execution for specified seconds
  1191.  
  1192.    SYNOPSIS
  1193.     sleep (seconds)
  1194.  
  1195.     void sleep (int seconds);
  1196.  
  1197.    FUNCTION
  1198.     Simplistic function.  Simply calls AmigaDOS 'Delay()' function
  1199.     with 'seconds * TICK_PER_SECOND' as a parameter.
  1200.  
  1201.    INPUTS
  1202.     seconds     - number of seconds to pause
  1203.  
  1204.    RESULT
  1205.     None
  1206.  
  1207.    EXAMPLE
  1208.  
  1209.    NOTES
  1210.     Unix implementation returns "unsigned". Oh, well.
  1211.  
  1212.    BUGS
  1213.  
  1214.    SEE ALSO
  1215.     dos.library/Delay()
  1216.  
  1217. unix/SockBase                                                   unix/SockBase
  1218.  
  1219.    NAME
  1220.     SockBase - declaration of library base for socket.library
  1221.  
  1222.    SYNOPSIS
  1223.     extern struct Library *SockBase;
  1224.  
  1225.    FUNCTION
  1226.     Simply a declaration of the library base for socket, used
  1227.     if not declared in other code.
  1228.  
  1229.    INPUTS
  1230.  
  1231.    RESULT
  1232.  
  1233.    NOTES
  1234.  
  1235.    BUGS
  1236.  
  1237.    SEE ALSO
  1238.  
  1239. unix/socket_callback                                     unix/socket_callback
  1240.  
  1241.    NAME
  1242.     socket_callback - can 'fd' by used by socket.library
  1243.  
  1244.    SYNOPSIS
  1245.     retval = socket_callback (fd)
  1246.     D0              D0
  1247.  
  1248.     SAS/C:
  1249.  
  1250.     unsigned long __regargs __asm __saveds socket_callback (register __d0 int fd
  1251. );
  1252.  
  1253.     DICE:
  1254.  
  1255.     unsigned long __geta4 socket_callback (__d0 int fd);
  1256.  
  1257.    FUNCTION
  1258.     socket_callback() checks, for a given compiler, whether a
  1259.     given 'fd' is already in use by the program.
  1260.  
  1261.    INPUTS
  1262.     'fd' is the file descriptor to be checked.
  1263.  
  1264.    RESULT
  1265.     If the fd is invalid, -1 is returned.
  1266.     If the fd is in use, 1 is returned.
  1267.     If the fd is available for use, 0 is returned.
  1268.  
  1269.    NOTES
  1270.     Invalid means "< 0".
  1271.  
  1272.     For the SAS/C library, socket_callback() uses
  1273.     __chkufb() and checks the ufb->ufbflg if it's
  1274.     result is non-NULL.
  1275.  
  1276.     For the DICE library, socket_callback() uses
  1277.     __getfh() and makes sure the result is NULL.
  1278.  
  1279.     Take care that all fd and sockets are marked
  1280.     correctly.
  1281.  
  1282.    BUGS
  1283.  
  1284.    SEE ALSO
  1285.     s_dev_func
  1286.  
  1287. unix/stat                                                           unix/stat
  1288.  
  1289.    NAME
  1290.     stat, fstat -- get file status
  1291.  
  1292.    SYNOPSIS
  1293.     #include <sys/types.h>
  1294.     #include <sys/stat.h>
  1295.  
  1296.     return = stat (filename, buf)
  1297.     return = fstat (fd, buf)
  1298.     return = lstat (filename, buf)
  1299.  
  1300.     int stat (const char *, struct stat *);
  1301.     int fstat (int, struct stat *);
  1302.     int lstat (const char *, struct stat *);
  1303.  
  1304.    FUNCTION
  1305.     stat() obtains information about the named file. fstat()
  1306.     obtains information about the specified file descriptor.
  1307.     lstat() functions exactly as does stat(), it does not
  1308.     return data only upon the link.
  1309.  
  1310.     The stat structure pointer to by "buf" is filled in. The
  1311.     following fields are used:
  1312.  
  1313.         u_short     st_mode;
  1314.         short        st_uid;
  1315.         short        st_gid;
  1316.         long        st_size;
  1317.         long        st_mtime;
  1318.         long        st_atime;     same as st_mtime
  1319.         short        st_nlink;     always 1
  1320.         long        st_blksize;
  1321.         long        st_blocks;
  1322.  
  1323.    INPUTS
  1324.     filename    full or relative pathname of file
  1325.     fd        file descriptor
  1326.  
  1327.     buf        pointer to a stat structure
  1328.  
  1329.    RESULT
  1330.     On success,  0 is returned.
  1331.     On failure, -1 is returned, and errno is set.
  1332.  
  1333.    EXAMPLE
  1334.     struct stat buf;
  1335.  
  1336.     if (stat ("devs:foo", &buf) == -1)
  1337.     {
  1338.         printf ("Error: file not found\n");
  1339.         exit (1);
  1340.     }
  1341.  
  1342.    NOTES
  1343.     On Amiga files, st_uid and st_gid will be set to that
  1344.     of the local user.  The networking software must have been
  1345.     started or -1 will be returned for both.
  1346.  
  1347.     While I-Net 225 in general does require 2.04 and above,
  1348.     these routines specfically do.
  1349.  
  1350.    BUGS
  1351.  
  1352.    SEE ALSO
  1353.  
  1354.  
  1355. unix/statfs                                                       unix/statfs
  1356.  
  1357.    NAME
  1358.     statfs, fstatfs -- get file system status
  1359.  
  1360.    SYNOPSIS
  1361.     #include <sys/vfs.h>
  1362.  
  1363.     return = statfs (filename, buf)
  1364.     return = fstatfs (fd, buf)
  1365.  
  1366.     int statfs (const char *, struct statfs *);
  1367.     int fstatfs (int, struct statfs *);
  1368.  
  1369.    FUNCTION
  1370.     stat() obtains information about the named filesystem.
  1371.     fstatfs() obtains information about the filesystem that
  1372.     the specified file descriptor resides upon.
  1373.  
  1374.     The statfs structure pointer to by "buf" is filled in. The
  1375.     following fields are used:
  1376.  
  1377.      struct statfs {
  1378.          long    f_type;     /* type of filesystem */
  1379.          long    f_bsize;     /* optimal transfer block size */
  1380.          long    f_blocks;     /* total data blocks in file system */
  1381.          long    f_bfree;     /* free blocks in fs */
  1382.          long    f_bavail;     /* free blocks avail to non-superuser */
  1383.          long    f_files;     /* total file nodes in file system */
  1384.          long    f_ffree;     /* free file nodes in fs */
  1385.          fsid_t  f_fsid;     /* file system id */
  1386.          long    f_namelen;  /* maximum length of filenames */
  1387.      #define     f_namemax        f_namelen
  1388.          char    f_basetype [32];
  1389.          long    f_flag;
  1390.      };
  1391.  
  1392.    INPUTS
  1393.     filename    full or relative pathname of file
  1394.     fd        file descriptor
  1395.  
  1396.     buf        pointer to a statfs structure
  1397.  
  1398.    RESULT
  1399.     On success,  0 is returned.
  1400.     On failure, -1 is returned, and errno is set.
  1401.  
  1402.    EXAMPLE
  1403.     struct statfs buf;
  1404.  
  1405.     if (statfs ("devs:foo", &buf) == -1)
  1406.     {
  1407.         printf ("Error: file not found\n");
  1408.         exit (1);
  1409.     }
  1410.  
  1411.    NOTES
  1412.     Most information for this command comes from the Info()
  1413.     dos.library call. f_fsid[0] is the DOS UnitNumber. f_fsid[1]
  1414.     is always zero. f_basetype is either OFS, FFS, IOFS, IFFS,
  1415.     or the id_DiskType if the above are not appropriate.
  1416.  
  1417.     f_namelen is always 107, but the filesystem may not be able
  1418.     to support a name that long!
  1419.  
  1420.    BUGS
  1421.  
  1422.    SEE ALSO
  1423.  
  1424.  
  1425. unix/s_accept                                                   unix/s_accept
  1426.  
  1427.    NAME
  1428.     s_accept - accept socket and mark it as used
  1429.  
  1430.    SYNOPSIS
  1431.     retval = s_accept (sock, name, lenp)
  1432.  
  1433.     int s_accept (int, struct sockaddr *, int *);
  1434.  
  1435.    FUNCTION
  1436.     s_accept() is a wrapper for the accept() function in
  1437.     socket.library. It marks the socket returned as in-use
  1438.     for the compiler, so that the compiler will not open
  1439.     a file with the same descriptor number.
  1440.  
  1441.     If you are using unix.lib to obtain stdio on sockets,
  1442.     you must use s_accept() instead of accept(). You must
  1443.     also open socket.library using init_sock().
  1444.  
  1445.    INPUTS
  1446.     Same as accept()
  1447.  
  1448.    RESULT
  1449.     Same as accept()
  1450.  
  1451.    NOTES
  1452.  
  1453.    BUGS
  1454.  
  1455.    SEE ALSO
  1456.     accept()
  1457.     s_socket()
  1458.  
  1459. unix/s_socket                                                   unix/s_socket
  1460.  
  1461.    NAME
  1462.     s_socket - obtain socket and mark it as used
  1463.  
  1464.    SYNOPSIS
  1465.     retval = s_socket (addr_fam, type, prot_fam);
  1466.  
  1467.     int s_socket (int, int, int);
  1468.  
  1469.    FUNCTION
  1470.     s_socket() is a wrapper for the socket() function in
  1471.     socket.library. It marks the socket returned as in-use
  1472.     for the compiler, so that the compiler will not open
  1473.     a file with the same descriptor number.
  1474.  
  1475.     If you are using unix.lib to obtain stdio on sockets,
  1476.     you must use s_socket() instead of socket(). You must
  1477.     also open socket.library using init_sock().
  1478.  
  1479.    INPUTS
  1480.     Same as socket().
  1481.  
  1482.    RESULT
  1483.     Same as socket().
  1484.  
  1485.    NOTES
  1486.  
  1487.    BUGS
  1488.  
  1489.    SEE ALSO
  1490.     socket()
  1491.     s_accept()
  1492.  
  1493. unix/verr                                                           unix/verr
  1494.  
  1495.    NAME
  1496.     verr    -- vectored print an error message and EXIT.
  1497.  
  1498.    SYNOPSIS
  1499.     #include <err.h>
  1500.  
  1501.     verr (eval, fmt, args)
  1502.  
  1503.     void verr (int eval, const char *fmt, va_list args);
  1504.  
  1505.    FUNCTION
  1506.     Prints an error message of the form
  1507.  
  1508.         <progname>: [<formatted fmt>: ]<errno error message>
  1509.  
  1510.     and then exits with the value of 'eval'.
  1511.  
  1512.    INPUTS
  1513.     eval        - value for exit() call; program return code
  1514.     fmt        - if non-NULL, format & print output, followed
  1515.               by errno information string.  If NULL, only
  1516.               errno information string is output.
  1517.     args        - args for format string, fmt
  1518.  
  1519.    RESULT
  1520.     None
  1521.  
  1522.    EXAMPLE
  1523.  
  1524.    NOTES
  1525.  
  1526.    BUGS
  1527.  
  1528.    SEE ALSO
  1529.     err(), errx(), verrx(), warn(), vwarn(), warnx(), vwarnx()
  1530.  
  1531. unix/verrx                                                         unix/verrx
  1532.  
  1533.    NAME
  1534.     verrx    -- vectored print an error message and EXIT.
  1535.  
  1536.    SYNOPSIS
  1537.     #include <err.h>
  1538.  
  1539.     verrx (eval, fmt, args)
  1540.  
  1541.     void verrx (int eval, const char *fmt, va_list args);
  1542.  
  1543.    FUNCTION
  1544.     Prints an error message of the form
  1545.  
  1546.         <progname>: [<formatted fmt>]
  1547.  
  1548.     and then exits with the value of 'eval'.
  1549.  
  1550.    INPUTS
  1551.     eval        - value for exit() call; program return code
  1552.     fmt        - if non-NULL, format & print output
  1553.     args        - args for format string, fmt
  1554.  
  1555.    RESULT
  1556.     None
  1557.  
  1558.    EXAMPLE
  1559.  
  1560.    NOTES
  1561.  
  1562.    BUGS
  1563.  
  1564.    SEE ALSO
  1565.     err(), verr(), errx(), warn(), vwarn(), warnx(), vwarnx()
  1566.  
  1567. unix/vwarn                                                         unix/vwarn
  1568.  
  1569.    NAME
  1570.     vwarn    -- print a warning message.
  1571.  
  1572.    SYNOPSIS
  1573.     #include <err.h>
  1574.  
  1575.     vwarn (fmt, args)
  1576.  
  1577.     void vwarn (const char *fmt, va_list args);
  1578.  
  1579.    FUNCTION
  1580.     Prints a warning message of the form
  1581.  
  1582.         <progname>: [<formatted fmt>: ]<errno error message>
  1583.  
  1584.    INPUTS
  1585.     fmt        - if non-NULL, format & print output, followed
  1586.               by errno information string.  If NULL, only
  1587.               errno information string is output.
  1588.     args        - args for format string, fmt
  1589.  
  1590.    RESULT
  1591.     None
  1592.  
  1593.    EXAMPLE
  1594.  
  1595.    NOTES
  1596.  
  1597.    BUGS
  1598.  
  1599.    SEE ALSO
  1600.     err(), verr(), errx(), verrx(), warn(), warnx(), vwarnx()
  1601.  
  1602. unix/vwarnx                                                       unix/vwarnx
  1603.  
  1604.    NAME
  1605.     vwarnx    -- print a warning message.
  1606.  
  1607.    SYNOPSIS
  1608.     #include <err.h>
  1609.  
  1610.     vwarnx (fmt, args)
  1611.  
  1612.     void vwarnx (const char *fmt, va_list args);
  1613.  
  1614.    FUNCTION
  1615.     Prints a warning message of the form
  1616.  
  1617.         <progname>: [<formatted fmt>]
  1618.  
  1619.    INPUTS
  1620.     fmt        - if non-NULL, format & print output
  1621.     args        - args for format string, fmt
  1622.  
  1623.    RESULT
  1624.     None
  1625.  
  1626.    EXAMPLE
  1627.  
  1628.    NOTES
  1629.  
  1630.    BUGS
  1631.  
  1632.    SEE ALSO
  1633.     err(), verr(), errx(), verrx(), warn(), vwarn(), warnx()
  1634.  
  1635. unix/warn                                                           unix/warn
  1636.  
  1637.    NAME
  1638.     warn    -- print a warning message.
  1639.  
  1640.    SYNOPSIS
  1641.     #include <err.h>
  1642.  
  1643.     warn (fmt, ...)
  1644.  
  1645.     void warn (const char *fmt, ...);
  1646.  
  1647.    FUNCTION
  1648.     Prints a warning message of the form
  1649.  
  1650.         <progname>: [<formatted fmt>: ]<errno error message>
  1651.  
  1652.    INPUTS
  1653.     fmt        - if non-NULL, format & print output, followed
  1654.               by errno information string.  If NULL, only
  1655.               errno information string is output.
  1656.     ...        - variable list of args for format string, fmt
  1657.  
  1658.    RESULT
  1659.     None
  1660.  
  1661.    EXAMPLE
  1662.  
  1663.    NOTES
  1664.     First appeared in BSD 4.4.
  1665.  
  1666.    BUGS
  1667.  
  1668.    SEE ALSO
  1669.     err(), verr(), errx(), verrx(), warnx(), vwarn(), vwarnx()
  1670.  
  1671. unix/warnx                                                         unix/warnx
  1672.  
  1673.    NAME
  1674.     warnx    -- print a warning message.
  1675.  
  1676.    SYNOPSIS
  1677.     #include <err.h>
  1678.  
  1679.     warnx (fmt, ...)
  1680.  
  1681.     void warnx (const char *fmt, ...);
  1682.  
  1683.    FUNCTION
  1684.     Prints a warning message of the form
  1685.  
  1686.         <progname>: [<formatted fmt>]
  1687.  
  1688.    INPUTS
  1689.     fmt        - if non-NULL, format & print output
  1690.     ...        - variable list of args for format string, fmt
  1691.  
  1692.    RESULT
  1693.     None
  1694.  
  1695.    EXAMPLE
  1696.  
  1697.    NOTES
  1698.  
  1699.    BUGS
  1700.  
  1701.    SEE ALSO
  1702.     err(), verr(), errx(), verrx(), warn(), vwarn(), vwarnx()
  1703.  
  1704. unix/write                                                         unix/write
  1705.  
  1706.    NAME
  1707.     write -- write to a file or socket
  1708.  
  1709.    SYNOPSIS
  1710.     status = write (unit, buffer, length);
  1711.  
  1712.     int  = write (int, void *, unsigned int);
  1713.  
  1714.    FUNCTION
  1715.     This function writes a set of bytes to the current file
  1716.     position.
  1717.  
  1718.    INPUTS
  1719.     unit      unit number
  1720.     buffer      output buffer
  1721.     length      buffer length in bytes
  1722.  
  1723.    RESULT
  1724.     status      = number of bytes actually written
  1725.           = -1 if error occurred
  1726.  
  1727.    EXAMPLE
  1728.  
  1729.    NOTES
  1730.     This replaces the normal compiler write() function.
  1731.  
  1732.     write() is a wrapper for the __write() function in
  1733.     sc.lib and for send() in socket.library. If the unit
  1734.     has been marked as a socket, then send() is called,
  1735.     otherwise __write() is called.
  1736.  
  1737.     If you are using unix.lib to obtain stdio on sockets,
  1738.     you must use write() instead of __write(). You must
  1739.     also open socket.library using init_sock().
  1740.  
  1741.    BUGS
  1742.  
  1743.    SEE ALSO
  1744.     init_socket
  1745.     close
  1746.     read
  1747.  
  1748.